<script>
export default {
  onLaunch: function () {
    console.warn(
      '当前组件仅支持 uni_modules 目录结构 ，请升级 HBuilderX 到 3.1.0 版本以上！'
    )
    console.log('App Launch')

    const { token, expiretime } = uni.getStorageSync('userInfo')
    if (!token) {
      uni.clearStorageSync()
      uni.reLaunch({
        url: '/pages/login/index'
      })
    } else {
      // 登录过期
      const timestamp = parseInt(Date.now() / 1000)
      if (timestamp > expiretime) {
        uni.clearStorageSync()
        uni.reLaunch({
          url: '/pages/login/index'
        })
      }
    }
  },
  onShow: function () {
    console.log('App Show')
  },
  onHide: function () {
    console.log('App Hide')
  },
  globalData: {
    goods: null
  }
}
</script>

<style lang="scss">
/*每个页面公共css */
@import '@/uni_modules/uni-scss/index.scss';
@import '@/static/css/index.css';
@import '@/static/iconfont/iconfont.css';
@import '@/static/iconfont/iconfont-weapp-icon.css';
@import '@/static/css/public.css';
@import '@/static/css/uniless.css';
// 设置整个项目的背景色
page {
  background-color: #f7f7f7;
}

checkbox.round .wx-checkbox-input,
checkbox.round .uni-checkbox-input {
  border-radius: 50%;
}
</style>
